package 笔记.设计模式.工厂模式;

/**
 * @author chenhailong
 * @ClassName: FactoryBean
 * @Description: 工厂生产线
 * @date 2021/6/29 20:35
 * @Version 1.0
 */
public class FactoryBean {

    public Factory getBean(String string) {
        if (string == null || string.isEmpty()) {
            return null;
        }
        if (string.equalsIgnoreCase("factoryOne")) {
            return new FactoryOne();
        } else if (string.equalsIgnoreCase("factoryTwo")) {
            return new FactoryTwo();
        }
        return null;
    }
}
